member?

 

Member? can be used with lists or agentsets, but is more commonly used with lists. Member? reports True if the given value or agent appears in the given list or agentset, and takes the form member? value list or member? agent agentset. For example, show member? 5 [ 3 4 5 6 ] would report True, and show member? 5 [1 3 2 ] would report False; show member? turtle 0 turtle would report True, while show member? patch 0 turtles would report False.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the member? primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the member? primitive:
 
 
Similar primitives:
count

Count the number of agents in an agentset.

Read more
if-else

execute specific code if a condition is true, otherwise, execute other code

Read more
 
Learn another primitive